package main

import (
	"common/database/config"
	"flag"
	"fmt"
	"google.golang.org/grpc"
	"log"
	"net"
	_ "project_video_srv/initialization"
	"project_video_srv/internal/server"
	__ "project_video_srv/proto"
)

var (
	port = flag.Int("port", config.Configs.System.Port, "The server port")
)

func main() {
	flag.Parse()
	lis, err := net.Listen("tcp", fmt.Sprintf(":%v", *port))
	s := grpc.NewServer()
	__.RegisterVideoServer(s, &server.Server{})
	log.Printf("server listening at %v", lis.Addr())
	if err = s.Serve(lis); err != nil {
		log.Fatalf("failed server %v", err)
		return
	}
}
